home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softdisk Supreme
/
Softdisk Supreme.iso
/
pc
/
DSK Files
/
0-49
/
SD008b.dsk
/
HEX.TO.TEN.bas
< prev
next >
Wrap
BASIC Source File
|
2003-06-12
|
3KB
|
80 lines
100 REM <CTRL-J>************************ * * * BASE 10 TO HEX AND * * BACK * * * ************************
110 GOSUB 700
120 ONERR GOTO 130
130 HOME : VTAB 3: HTAB 10
140 PRINT "<1> HEX TO BASE 10"
150 HTAB 10: PRINT "<2> BASE 10 TO HEX"
160 HTAB 10: PRINT "<3> QUIT
170 VTAB 11
180 HTAB 10: PRINT "WHICH? <";: GET A: PRINT A;">"
190 VTAB 8: HTAB 10: IF A <3 OR A >0 THEN PRINT "-RETURN TO CHANGE-"
200 IF A = 1 GOTO 290
210 IF A = 2 GOTO 430
220 IF A = 3 THEN 660
230 GOTO 130
240 INPUT A$: IF LEFT$(A$,1) = "Y" THEN 290
250 PRINT "BASE 10 TO HEX ";
260 INPUT A$: IF LEFT$(A$,1) = "Y" THEN 1200
270 GOTO 130
280 REM <CTRL-J>************************ * * * HEX TO BASE 10 * * * ************************<CTRL-J>
290 VTAB 11: CALL -958
300 HTAB 10: PRINT "INPUT HEX VALUE $";
310 INPUT "";H$
320 IF LEN(H$) = 0 THEN 130
330 D = 0
340 FOR J = 1 TO LEN(H$)
350 X = ASC( MID$ (H$,J,1))
360 IF (X >47 AND X <58) OR (X >64 AND X <71) THEN D = D *16 +X -48 -(X >58) *7
370 NEXT J
380 VTAB 16: HTAB 8
390 PRINT "BASE 10 EQUIVALENT = ";D
400 VTAB 23: PRINT " ANY KEY ";
410 GET Q$: PRINT : GOTO 290
420 REM <CTRL-J>************************ * * * BASE 10 TO HEX * * * ************************<CTRL-J>
430 VTAB 11: CALL -958
440 HTAB 7: PRINT "INPUT BASE 10 VALUE";
450 INPUT " ";T$
460 IF LEN(T$) = 0 THEN 130
470 T = VAL(T$)
480 IF T <1 THEN 430
490 T = INT(T)
500 H = 0:H$ = " "
510 FOR J = 1 TO 15
520 IF T <16 ^J THEN 550
530 NEXT J
540 PRINT "THE NUM IS TOO LARGE": GOTO 430
550 FOR K = J -1 TO 0 STEP -1
560 H = INT(T/16 ^K)
570 H$ = H$ + CHR$(H +48 +(H >9) *7)
580 T = T -H *16 ^K
590 NEXT K
600 L = LEN(H$):H$ = RIGHT$(H$,L -1)
610 VTAB 15: HTAB 8
620 PRINT "HEX VALUE = $";H$
630 VTAB 23: PRINT " ANY KEY ";
640 GET Q$: PRINT : GOTO 430
650 REM <CTRL-J>************************ * * * END OF PROGRAM * * * ************************<CTRL-J>
660 HOME
670 PRINT CHR$(4)"RUNHELLO"
680 END
690 REM <CTRL-J>************************ * * * DIRECTIONS ON THE * * CONVERTER * * * ************************<CTRL-J>
700 HOME : SPEED= 255
710 VTAB 3
720 FOR K = 1 TO 40: PRINT "*";: NEXT
730 GOSUB 870
740 PRINT "*";: HTAB 9
750 PRINT "THE FIRST PART OF MENU";: HTAB 40: PRINT "*";: GOSUB 870
760 PRINT "*";: HTAB 8: PRINT "IS EASY, ENTER A NUMBER.";: HTAB 40: PRINT "*";: GOSUB 870
770 PRINT "*";: HTAB 7: PRINT "< YOUR CHOICE FROM 1 TO 3 >";: HTAB 40: PRINT "*";: GOSUB 870
780 PRINT "*";: HTAB 18: PRINT "THEN";: HTAB 40: PRINT "*";: GOSUB 870
790 PRINT "*";: HTAB 7: PRINT "HIT RETURN WITHOUT AN INPUT";: HTAB 40: PRINT "*";: GOSUB 870
800 PRINT "*";: HTAB 7: PRINT "TO RETURN TO THE FIRST PART";: HTAB 40: PRINT "*";: GOSUB 870
810 PRINT "*";: HTAB 14: PRINT "OF THE MENU.";: HTAB 40: PRINT "*";: GOSUB 870
820 GOSUB 870
830 FOR K = 1 TO 40: PRINT "*";: NEXT K
840 VTAB 23: HTAB 12
850 PRINT "PRESS ANY KEY ";
860 GET Q$: PRINT : RETURN
870 PRINT "*";: HTAB 40: PRINT "*";
880 RETURN
900 REM ************************ * * * THANKS TO --------- * * MONTGOMERY A. LEE * * FOR POKE 33,28 * ************************